package org.taofuxn.framework.mvp;


import android.os.Bundle;
import android.support.annotation.Nullable;

import org.taofuxn.framework.ui.base.BaseActivity;


/*
 * Created by wanghuafu on 16/9/15.
 */

public abstract class MvpActivity<P extends BasePresenter> extends BaseActivity {

    private P mPrestener;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mPrestener = createDefaultPresenter();
    }

    protected abstract P createDefaultPresenter();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (mPrestener != null)
            mPrestener.onDetachView();
    }
}
